package com.coincalf.web;

import com.coincalf.framework.http.Response;
import com.coincalf.service.UserService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@Slf4j
@RestController
@RequestMapping("/user/service")
@Api(value = "用户Controller", description = "用户Controller")
public class UserRegisterController {

    @Autowired
    private UserService userService;

    /**
     * JAVA这边注册接口暂时废弃 调用PHP注册接口 同时PHP调用该接口 将用户数据写入
     *
     * @return
     */
    @PostMapping("register")
    @ApiOperation(value = "注册-PHP专用", httpMethod = "POST")
    public Object register(String token) {
        if (StringUtils.isBlank(token)) {
            return Response.err(500, "TOKEN不能为空");
        }
        return userService.registerForPhp(token);
    }

}
